import {extend, localize} from 'vee-validate'
import {required,email,min,length,confirmed} from 'vee-validate/dist/rules'
import zh from 'vee-validate/dist/locale/zh_CN.json'
extend('email',email)
extend('min',min)
extend('required',required)
extend('length',length)
extend('confirmed',confirmed)
extend('phone',{
    validate: value => {
        return /^1[2-9]\d{9}$/.test(value)
    }
})

localize('zh_CN',{
    messages : {
        ...zh.messages,
        required:"{_field_}不能为空！",
        phone:'请输入正确的11位{_field_}'
    },
    names: {
        email:'邮箱',
        password:'密码',
        name:'昵称',
        username:'账号',
        code:"验证码",
        phone:"手机号"
    },
    fields: {
        email:{
            email: '请输入正确的{_field_}格式',
            required:"请输入{_field_}"
        }
    }
})